﻿using System;
using System.Runtime.Serialization;

namespace SharpGym.WCF.Dto
{
    public partial class AlunoDto
    {
        [DataMember]
        public double Idade
        {
            get
            {
                var Aniversario = new DateTime(DataNascimento);
                var now = DateTime.Today;
                var age = now.Year - Aniversario.Year;
                if (Aniversario > now.AddYears(-age)) age--;

                return age;
            }
            private set{}
        }
    }
}